<template>
  <div class="app">
    <h2>
      {{ title }}
    </h2>
    <Banner :msg="bannerData" :index="bannerIndex" @getIndex="active" />
  </div>
</template>

<script>
import { ref, reactive } from "vue";
import Banner from './components/Banner.vue'

export default {
  name: 'App',
  components: {
    Banner
  },
  setup() {
    const title = ref("正在封装轮播图组件");
    const bannerData = reactive([{
      img: "",
      title: "图11"
    }, {
      img: "",
      title: "图22"
    }, {
      img: "",
      title: "图33"
    }, {
      img: "",
      title: "图44"
    }]);
    const bannerIndex = ref(3);

    const active = (i) => {
      console.log(i);
    }
    return { title, bannerIndex, bannerData, active }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
